package week03;

import java.util.Scanner;



class Person {

	private String name;
	private int age;
	private boolean gender;
	private int id;
	private static int idnum = -1;
	
	static {
		System.out.println("This is static initialization block");
	}
	
	public Person(){
		idnum++;
		this.id 

=idnum;
		System.out.printf("This is initialization block, id is %d%n",id);
		System.out.println("This is constructor");
		System.out.printf("%s,%d,%s,%d%n", name,age,gender,id);
		
	}
	
	public Person(String name,int age, boolean gender) {
		this.name 

 = name;
		this.gender = gender;
		this.age = age;
		idnum+=1;
		this.id 

 = idnum;
		System.out.printf("This is initialization block, id is %d%n",id);
	}
	
	public void setName(String name){
		this.name 

 = name;
	}
	
	public String getName(){
		return name;
	}
	
	public void setGender(boolean gender){
		this.gender = gender;
	}

	public boolean getGender(){
		return gender;
	}
	
	public void setAge(int age){
		this.age = age;
	}
	
	public int getAge(){
		return age;
	}
	
	public String toString(){
		return String.format("Person [name=%s, age=%d, gender=%s, id=%d]", name,age,gender,id);
	}
	
}
public class ddk1 {
	public static void main(String[] args) {
		//System.out.println("666");
		Scanner sc = new Scanner(System.in 

);
		int n = sc.nextInt();
		Person [] pe = new Person[n];
		for (int i = 0; i < pe.length; i++) {
			Person per = new Person(sc.next(),sc.nextInt(),sc.nextBoolean());
			pe[i] = per;
		}
		for(int i = pe.length-1 ; i>=0 ; i--){
			System.out.println(pe[i]);
		}
		System.out.println(new Person());
		sc.close();
	}
}

